package com.evaluationsystem.system.serivce.impl;

import cn.hutool.core.date.DateUtil;
import com.evaluationsystem.Utils.UserContextUtils;
import com.evaluationsystem.system.dao.TlogsDao;
import com.evaluationsystem.system.entity.Tlogs;
import com.evaluationsystem.system.serivce.TlogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
public class TlogsServiceImpl implements TlogsService {

    @Autowired
    TlogsDao dao;

    @Autowired
    UserContextUtils userContextUtils;


    @Override
    @Transactional
    public int add(Tlogs tlogs) {
        tlogs.setVserialid(userContextUtils.getMaxid(dao.selTlogsMaxId(),"RZ",10,"0"))
                .setVoperationtime(DateUtil.now());
        int a = dao.addTlogs(tlogs);
        return a;
    }
}
